package com.fanrui.code.threadgroup;

public class GroupDeterminer<ENTITY_ID_TYPE> {
	
	private GroupingAlgorithm<ENTITY_ID_TYPE> algorithm;
	
	private int currentGroup;

	public GroupDeterminer(GroupingAlgorithm<ENTITY_ID_TYPE> algorithm, int currentGroup) {
		super();
		this.algorithm = algorithm;
		this.currentGroup = currentGroup;
	}
	
	public boolean isInGroup(ENTITY_ID_TYPE entityId) {
		return this.currentGroup == this.algorithm.getGroup(entityId);
	}

}
